"use strict";TABS.modes={},TABS.modes.initialize=function(e){function s(){MSP.send_message(MSP_codes.MSP_BOX,!1,!1,a)}function a(){MSP.send_message(MSP_codes.MSP_BOXIDS,!1,!1,n)}function n(){MSP.send_message(MSP_codes.MSP_RC,!1,!1,t)}function t(){$("#content").load("./tabs/modes.html",c)}function c(){function s(e,s){var a=0;s>1300&&s<1700?a=1:s>1700&&(a=2);var n=3*e+a+2,t=3*e+2;$("td:nth-child(n+"+t+"):nth-child(-n+"+(t+2)+")",i).css("background-color","transparent"),$("td:nth-child("+n+")",i).css("background-color","orange")}function a(){MSP.send_message(MSP_codes.MSP_RC,!1,!1,n)}function n(){for(var e=0;e<AUX_CONFIG.length;e++)bit_check(CONFIG.mode,e)?$("td.name").eq(e).addClass("on").removeClass("off"):($("td.name").eq(e).removeClass("on").removeClass("off"),AUX_CONFIG_values[e]>0&&$("td.name").eq(e).addClass("off"));for(var e=0;e<RC.active_channels-4;e++)s(e,RC.channels[e+4])}for(var t=$("table.boxes .heads"),c=$("table.boxes .main"),o=0;o<RC.active_channels-4;o++)t.append('<th colspan="3">AUX '+(o+1)+"</th>"),c.append('                <th i18n="auxiliaryLow"></th>                <th i18n="auxiliaryMed"></th>                <th i18n="auxiliaryHigh"></th>            ');translateAll();for(var o=0;o<AUX_CONFIG.length;o++){var d='<tr class="switches">';d+='<td class="name">'+AUX_CONFIG[o]+"</td>";for(var _=0;_<3*(RC.active_channels-4);_++)d+=bit_check(AUX_CONFIG_values[o],_)?'<td><input type="checkbox" checked="checked" /></td>':'<td><input type="checkbox" /></td>';d+="</tr>",$(".boxes > tbody:last").append(d)}$("a.update").click(function(){function e(){MSP.send_message(MSP_codes.MSP_EEPROM_WRITE,!1,!1,function(){GUI.log(getMessage("auxiliaryEepromSaved"))})}var s=0,a=0;$(".boxes input").each(function(){$(this).is(":checked")?AUX_CONFIG_values[s]=bit_set(AUX_CONFIG_values[s],a):AUX_CONFIG_values[s]=bit_clear(AUX_CONFIG_values[s],a),a++,a>=3*(RC.active_channels-4)&&(s++,a=0)}),MSP.send_message(MSP_codes.MSP_SET_BOX,MSP.crunch(MSP_codes.MSP_SET_BOX),!1,e)});var i=$("table.boxes .switches");n(),GUI.interval_add("aux_data_pull",a,50),GUI.interval_add("status_pull",function(){MSP.send_message(MSP_codes.MSP_STATUS)},250,!0),e&&e()}"modes"!=GUI.active_tab&&(GUI.active_tab="modes",googleAnalytics.sendAppView("Modes")),MSP.send_message(MSP_codes.MSP_BOXNAMES,!1,!1,s)},TABS.modes.cleanup=function(e){e&&e()};